<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
<title>用户信息</title>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/script/md5.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/script/jquery.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/script/jquery.validate-1.13.1.js"></script>
<style type="text/css">
body {
	font-family: "Microsoft YaHei", "SimSun", sans-serif;
	background: url("${pageContext.request.contextPath}/images/shui.jpg")
		no-repeat center 0%;
	background-size: cover;
	min-width: 900px;
}

td label {
	font-size: 20px;
}

td input {
	width: 300px;
	height: 30px;
	margin-top: 10px;
}

.title {
	font-size: 25px;
	padding-top: 10px;
	padding-bottom: 15px;
	font-weight: bold;
	border-bottom: 1px solid #449CFA;
}

.center {
	text-align: center;
}

.edit {
	text-align: center;
	margin: 0 auto;
}

.edit input {
	width: 140px;
	height: 40px;
	margin: 10px auto;
}

table {
	width: 300px;
	padding: 5px 50px;
	background: white;
	margin: 100px auto;
	border: 1px solid #A6A6A6;
}

.btn {
	display: inline-block;
	margin-bottom: 0;
	font-weight: normal;
	text-align: center;
	vertical-align: middle;
	cursor: pointer;
	background-image: none;
	border: 1px solid transparent;
	white-space: nowrap;
	padding: 6px 12px;
	font-size: 14px;
	line-height: 1.42857143;
	border-radius: 0;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	-o-user-select: none;
	user-select: none;
}

.btn:focus {
	outline: thin dotted #333;
	outline: 5px auto -webkit-focus-ring-color;
	outline-offset: -2px;
}

.btn:hover,.btn:focus {
	color: #333333;
	text-decoration: none;
}

.btn:active,.btn.active {
	outline: 0;
	background-image: none;
	-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
	box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}

.btn.disabled,.btn[disabled],fieldset[disabled] .btn {
	cursor: not-allowed;
	pointer-events: none;
	opacity: 0.65;
	filter: alpha(opacity = 65);
	-webkit-box-shadow: none;
	box-shadow: none;
}

.btn-primary {
	color: #ffffff;
	background-color: #428bca;
	border-color: #357ebd;
	border-radius: 4px;
}

.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary
	{
	color: #ffffff;
	background-color: #3276b1;
	border-color: #285e8e;
}

.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary
	{
	background-image: none;
}

.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active
	{
	background-color: #428bca;
	border-color: #357ebd;
}

input.error {
	border: 1px solid red;
}

label.error {
	padding-bottom: 2px;
	font-weight: bold;
	color: #EA5200;
	font-size: 13px;
}
</style>
</head>
<script type="text/javascript">
	function a(){
		var opassword=document.getElementById("opassword").value;		
		var password=document.getElementsByName("password")[0].value;
		password=hex_md5(password);
		var new_password=document.getElementsByName("newpassword")[0].value;
		var confirm_password=document.getElementsByName("confirmpassword")[0].value;
		if(opassword!=password){
			alert("原密码错误！");
			return false;
		}
		if(new_password.length<1){
			alert("密码不能为空！");
			return false;
		}
		if(new_password!=confirm_password){
			alert("两次输入密码不一致，请重新输入！");
			return false;
		}
		else{
			document.form.submit();
			return true;
		}
	}
</script>
<body>
	<div id="container">
		<div class="edit_password">
			<s:form action="operator_changePassword" name="form" target="right"
				id="edit_pass">
				<table>
					<tr>
						<td class="center title">修改密码</td>
					</tr>
					<tr>
						<td><s:hidden name="opassword" id="opassword"
								value="%{#session.operator.password}" /></td>
					</tr>
					<tr>
						<td><label for="password">当前密码</label><br> <s:password
								type="password" name="password" placeholder="请输入原密码" /></td>
					</tr>
					<tr>
						<td><label for="new_password">新密码</label><br> <s:password
								type="password" name="newpassword" id="newpassword"
								placeholder="请输入新密码" /></td>
					</tr>
					<tr>
						<td><label for="confirm_password">确认密码</label><br> <s:password
								type="password" name="confirmpassword" placeholder="确认密码和新密码一致" />
						</td>
					</tr>
					<tr>
						<td><s:hidden name="id"
								value="%{#session.operator.id}" /></td>

					</tr>
					<tr>
						<td class="edit"><input type="button" value="修改密码"
							 onclick="a();" /> <input type="button"
							value="返回" class="btn btn-primary"
							onclick="javascript :history.back(-1);" /></td>
					</tr>
				</table>
			</s:form>
		</div>
	</div>
</body>
</html>
